﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ComesEnCasa.Entidades;

namespace ComesEnCasa.Datos.Repositorio
{
    public class RestauranteRepository : RepositoryBase
    {

        public List<Restaurante> Listado(int restauranteId)
        {
            return Contexto.Restaurantes.Where(r => r.RestauranteId == restauranteId).ToList();
        }

        public List<RestauranteCompleto> Buscar(string columnaParaOrdenar, string palabrasABuscar, int? rating, int pageSize, int pageIndex, out int pageTotal)
        {
            var paramOutPageTotal = new ObjectParameter("PageTotal", typeof(int));

            List<RestauranteCompleto> listado =
                Contexto.RestaurantesBuscar(columnaParaOrdenar, palabrasABuscar, rating, pageSize, pageIndex,
                                            paramOutPageTotal).ToList();

            pageTotal = Int32.Parse(paramOutPageTotal.Value.ToString());

            return listado;

            
        }
    }
}
